Skip to content

feat: improve generated request DTO ergonomics#49

Merged
matoous merged 1 commit intomainfrom
md/typing
Apr 23, 2026
Merged

feat: improve generated request DTO ergonomics#49
matoous merged 1 commit intomainfrom
md/typing

Conversation

@matoous
Copy link
Copy Markdown
Contributor

@matoous matoous commented Apr 23, 2026

Generate named-argument constructors and fromArray factories for OpenAPI request body DTOs.

This improves SDK ergonomics by making required fields explicit in typed DTO construction while preserving associative-array input for callers that already work with array payloads. Array request bodies passed to service methods are now hydrated through the generated DTO factories before encoding, so missing required fields fail locally before an HTTP request is made.

Response hydration now instantiates DTOs without invoking constructors, keeping response decoding compatible with request DTOs that have required constructor parameters. Tests and examples were updated to cover named constructors, fromArray hydration, enum coercion, and request body DTOs whose class names do not end in Request.

Generate named-argument constructors and `fromArray` factories for
OpenAPI request body DTOs.

This improves SDK ergonomics by making required fields explicit in
typed DTO construction while preserving associative-array input for
callers that already work with array payloads. Array request bodies
passed to service methods are now hydrated through the generated DTO
factories before encoding, so missing required fields fail locally
before an HTTP request is made.

Response hydration now instantiates DTOs without invoking
constructors, keeping response decoding compatible with request
DTOs that have required constructor parameters. Tests and examples
were updated to cover named constructors, fromArray hydration, enum
coercion, and request body DTOs whose class names do not end in
Request.
@matoous matoous self-assigned this Apr 23, 2026
@matoous matoous merged commit 4e71c06 into main Apr 23, 2026
14 checks passed
@matoous matoous deleted the md/typing branch April 23, 2026 12:37
@github-actions github-actions Bot mentioned this pull request Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant